package com.example.peanutsubway.service.abst;

import com.example.peanutsubway.dao.BookInfoDao;
import com.example.peanutsubway.dao.impl.BookInfoDaoImpl;
import com.example.peanutsubway.entity.BookInfo;
import com.example.peanutsubway.entity.BookType;
import com.example.peanutsubway.entity.Menu;
import com.example.peanutsubway.util.PageInfo;
import com.example.peanutsubway.service.BookService;

import com.example.peanutsubway.vo.BookTypeInfo;

import java.util.List;

/**
 * @Author：zzt
 * @Version：1.0
 * @Date：2021/10/12-10:59
 * @Since:jdk1.8
 * @Description:
 */
public abstract class BookServiceAbst implements BookService {
     private BookInfoDao bookInfoDao =  new BookInfoDaoImpl();

    @Override
    public PageInfo findAllBook(BookInfo bookInfo, String nowPage, String pageNum) {
        Integer count = bookInfoDao.count(bookInfo); // 游戏数量
        PageInfo page = new PageInfo(nowPage,pageNum,count);
        List<BookInfo> bookTypeInfos = bookInfoDao.findAllBook(bookInfo,page);
        page.setDataList(bookTypeInfos);
        return page;
    }

    @Override
    public List<BookType> findAllBookParentType() {
        return bookInfoDao.findAllBookParentType();
    }

    @Override
    public List<BookType> findAllBookSonType(Integer id) {
        return bookInfoDao.findAllBookSonType(id);
    }

    @Override
    public Boolean updateBookInfo(BookInfo bookInfo) {
        return bookInfoDao.updateBookInfo(bookInfo);
    }

    @Override
    public Boolean deleteBookSonType(Integer id) {
        return bookInfoDao.deleteBookSonType(id);
    }

    @Override
    public Boolean addBook(BookInfo bookInfo) {
        return bookInfoDao.addBookInfo(bookInfo);
    }
}
